<?php

/**
 * 加盟配置
 */
$title = '加盟配置';
include "header.php";
?>
<div class="row">
    <div class=" col-md-12 col-xl-12 col-lg-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-12">
                        <h3 class="mb-3 header-title text-success"><?= $title ?></h3>
                        <form class="form-horizontal layui-form">
                            <div class="card">
                                <div class="card-header bg-primary text-white">
                                    用户加盟相关配置
                                </div>
                                <div class="card-body">
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal">加盟开关</label>
                                        <select class="custom-select mt-3" lay-search name="userleague">
                                            <option <?= $conf['userleague'] == 1 ? 'selected' : '' ?> value="1">允许用户加盟
                                            </option>
                                            <option <?= $conf['userleague'] == -1 ? 'selected' : '' ?> value="-1">禁止用户加盟
                                            </option>
                                        </select>
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal">用户升级费用归属</label>
                                        <select class="custom-select mt-3" lay-search name="usergradecost">
                                            <option <?= $conf['usergradecost'] == 1 ? 'selected' : '' ?> value="1">奖励给他的上级站长,如果有的话
                                            </option>
                                            <option <?= $conf['usergradecost'] == -1 ? 'selected' : '' ?> value="-1">主站吞，不奖励
                                            </option>
                                        </select>
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">升级奖励分成百分比</label>
                                        <input type="number" name="userupgradeprofit" class="form-control" value="<?= $conf['userupgradeprofit'] ?>" placeholder="请填写完整">
                                        <span>和主站分成的比例,可填写0到100,代表0%-100%,如填写90，则用户获得90%，主站获得10%</span>
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">多少级可以加盟店铺？</label>
                                        <input type="number" name="userleaguegrade" class="form-control" value="<?= $conf['userleaguegrade'] ?>" placeholder="请填写完整">
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户多少级可以自定义公告/客服？</label>
                                        <input type="number" name="usergradenotice" class="form-control" value="<?= $conf['usergradenotice'] ?>" placeholder="请填写完整">
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">多少级可以自己提升商品售价？</label>
                                        <input type="number" name="usergradeprofit" class="form-control" value="<?= $conf['usergradeprofit'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">多少级可以自定义商品状态(上下架)？</label>
                                        <input type="number" name="usergradegoodsstate" class="form-control" value="<?= $conf['usergradegoodsstate'] ?>" placeholder="请填写完整">
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户多少级可以自定义店铺首页模板？</label>
                                        <input type="number" name="usergradetem" class="form-control" value="<?= $conf['usergradetem'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户注册默认等级</label>
                                        <input type="number" name="userdefaultgrade" class="form-control" value="<?= $conf['userdefaultgrade'] ?>" placeholder="请填写完整">
                                    </div>
                                </div>
                                <button type="submit" lay-submit lay-filter="Notification_set" class="btn btn-block btn-xs btn-success">保存内容
                                </button>
                            </div>
                            <div class="card">
                                <div class="card-header bg-info text-white">域名配置相关，（如baidu.com=域名主体，www=域名前缀）
                                </div>
                                <div class="card-body">
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal">加盟店域名绑定模式 <font color="red">(两个之间不可随意切换,选择好就只能够一条路走下去！,新站随意切换)</font></label>
                                        <select class="custom-select mt-3" lay-search name="userdomaintype">
                                            <option <?= $conf['userdomaintype'] == 1 ? 'selected' : '' ?> value="1">加盟店域名泛解析绑定，通过域名前缀判断
                                            </option>
                                            <option <?= $conf['userdomaintype'] == 2 ? 'selected' : '' ?> value="2">加盟店域名Cookie模式，通过域名后缀判断店铺,无需泛解析
                                            </option>
                                        </select>
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">加盟店铺可选域名主体，多个则英文逗号分割【,】</label>
                                        <input type="text" name="userdomain" class="form-control" value="<?= $conf['userdomain'] ?>" placeholder="请填写完整">
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">主站保留域名前缀/后缀,用户不可选，多个则英文逗号分割【,】</label>
                                        <input type="text" name="userdomainretain" class="form-control" value="<?= $conf['userdomainretain'] ?>" placeholder="请填写完整">
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户修改域名的价格是多少，单位/元</label>
                                        <input type="text" name="userdomainsetmoney" class="form-control" value="<?= $conf['userdomainsetmoney'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal">是否允许用户访问未绑定域名的站点</label>
                                        <select class="custom-select mt-3" lay-search name="userbinding">
                                            <option <?= $conf['userbinding'] == 1 ? 'selected' : '' ?> value="1">允许用户访问未绑定域名的站点
                                            </option>
                                            <option <?= $conf['userbinding'] == -1 ? 'selected' : '' ?> value="-1">禁止用户访问未绑定域名的站点
                                            </option>
                                        </select>
                                        <br>
                                        <span>
                                            仅支持泛解析绑定模式，默认放行域名<font color="#40e0d0"><?= $accredit['url'] ?>，www.<?= $accredit['url'] ?></font>，如果需要让用户无法访问主域名的话，可以将主域名解析到其他地方！<br>
                                            默认放行域名是安装程序时的域名，修改地址：<font color="#40e0d0">includes/deploy.php</font>，如果有需要，可以自己修改！
                                        </span>
                                    </div>
                                </div>
                                <button type="submit" lay-submit lay-filter="Notification_set" class="btn btn-block btn-xs btn-success">保存内容
                                </button>
                            </div>
                            <div class="card">

                                <div class="card-header bg-danger text-white">
                                    用户提现相关配置
                                </div>
                                <div class="card-body">
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal">提现开关</label>
                                        <select class="custom-select mt-3" lay-search name="userdeposit">
                                            <option <?= $conf['userdeposit'] == 1 ? 'selected' : '' ?> value="1">允许用户提现
                                            </option>
                                            <option <?= $conf['userdeposit'] == -1 ? 'selected' : '' ?> value="-1">禁止用户提现
                                            </option>
                                        </select>
                                    </div>
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户提现等级限制,多少级才可以提现？</label>
                                        <input type="number" name="userdepositgrade" class="form-control" value="<?= $conf['userdepositgrade'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户提现手续费是多少( 5 = 5%
                                            )？</label>
                                        <input type="number" name="userdepositservice" class="form-control" value="<?= $conf['userdepositservice'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户最低提现金额是多少？</label>
                                        <input type="number" name="userdepositmin" class="form-control" value="<?= $conf['userdepositmin'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">提现支持方式（1,1,1）1=开启,-1=关闭，(支付宝,微信,QQ)</label>
                                        <input type="text" name="userdeposittype" class="form-control" value="<?= $conf['userdeposittype'] ?>" placeholder="请填写完整">
                                    </div>

                                </div>
                                <button type="submit" lay-submit lay-filter="Notification_set" class="btn btn-block btn-xs btn-success">保存内容
                                </button>
                            </div>

                            <div class="card">

                                <div class="card-header bg-warning text-white">
                                    用户其他配置
                                </div>
                                <div class="card-body">
                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户每日绑定手机号短信发送次数限制</label>
                                        <input type="number" name="usersmsbinding" class="form-control" value="<?= $conf['usersmsbinding'] ?>" placeholder="请填写完整">
                                    </div>

                                    <div class="form-group mb-3">
                                        <label for="example-input-normal" style="font-weight: 500">用户每日登陆用户后台短信发送次数限制</label>
                                        <input type="number" name="usersmslogin" class="form-control" value="<?= $conf['usersmslogin'] ?>" placeholder="请填写完整">
                                    </div>
                                </div>
                            </div>

                            <button type="submit" lay-submit lay-filter="Notification_set" class="btn btn-block btn-xs btn-success">保存内容
                            </button>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


<?php include "bottom.php"; ?>

<script>
    layui.use('form', function() {
        var form = layui.form;
        form.on('submit(Notification_set)', function(data) {
            layer.alert('是否要执行当前操作？', {
                icon: 3,
                btn: ['确定', '取消'],
                btn1: function(layero, index) {
                    var index = layer.msg('数据保存中,请稍后...', {
                        icon: 16,
                        time: 999999
                    });
                    $.post('ajax.php?act=config_set', data.field, function(res) {
                        if (res.code == 1) {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function(layero, index) {
                                    location.reload();
                                }
                            });
                        } else {
                            layer.close(index);
                            layer.alert(res.msg, {
                                btn1: function(layero, index) {
                                    location.reload();
                                }
                            });
                        }
                    });
                }
            });
            return false;
        })
    });
    $("#query_xc").click(function() {
        var index2 = layer.prompt({
            formType: 3,
            value: '',
            title: '请输入小储云商城站点,需加http://',
        }, function(value, index, elem) {
            var index = layer.msg('公告数据获取中,请稍后...', {
                icon: 16,
                time: 999999
            });
            $.post('ajax.php?act=Get_notice_xc', {
                url: value
            }, function(res) {
                if (res.code == 1) {
                    layer.close(index);
                    $.each(res.data, function(index, value) {
                        $("textarea[name='" + index + "']").val(value);
                    });
                    layer.alert(res.msg, {
                        icon: 1
                    });
                    layer.close(index2);
                } else {
                    layer.close(index);
                    layer.alert(res.msg, {
                        icon: 2
                    });
                }
            });
        });
    });
    $("#query_ch").click(function() {
        var index2 = layer.prompt({
            formType: 3,
            value: '',
            title: '请输入彩虹代刷站点,需加http://',
        }, function(value, index, elem) {
            var index = layer.msg('公告数据获取中,请稍后...', {
                icon: 16,
                time: 999999
            });
            $.post('ajax.php?act=Get_notice_ch', {
                url: value
            }, function(res) {
                if (res.code == 1) {
                    layer.close(index);
                    $.each(res.data, function(index, value) {
                        $("textarea[name='" + index + "']").val(value);
                    });
                    layer.alert(res.msg, {
                        icon: 1
                    });
                    layer.close(index2);
                } else {
                    layer.close(index);
                    layer.alert(res.msg, {
                        icon: 2
                    });
                }
            });
        });
    })
</script>